console.log('111');

setTimeout(function () {
    console.log('444')
}, 20)
let promise = new Promise((resolve, reject) => {
    // promise中的内容是同步代码
    console.log('555');
    if (true) {
        resolve('666');
    } else {
        reject('777');
    }
})

promise.then((data) => {
    console.log(data);
})
promise.finally(() => {
    console.log('888');
})
promise.catch((err) => {
    console.log(err);
});
process.nextTick(() => {
    console.log('999');
})
setImmediate(() => {
    console.log('1010');
})

console.log('222');
// 1 5 2 9 6 8 4 10
// 1 5 2 9 6 8 10 4
// 